package com.hljx.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hljx.dto.DateDTO;
import com.hljx.entity.EtlItemSummary;
import com.hljx.entity.WorkloadSummary;
import com.hljx.excel.ExcelTransfer;
import com.hljx.mapper.sys.EtlItemSummaryMapper;
import com.hljx.service.EtlItemSummaryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hljx.vo.WorkloadTargetAdministrationDeptProjectVO;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2023-11-09
 */
@Service
public class EtlItemSummaryServiceImpl extends ServiceImpl<EtlItemSummaryMapper, EtlItemSummary> implements EtlItemSummaryService {

    @Autowired
    private ExcelTransfer<EtlItemSummary> excelTransfer;

    @Override
    public IPage<EtlItemSummary> listByPage(DateDTO dateDTO) {
        Page<EtlItemSummary> page = new Page<>(dateDTO.getPageNum(), dateDTO.getPageSize());
        IPage<EtlItemSummary> itemSummaryIPage = baseMapper.listByPage(page, dateDTO);
        return itemSummaryIPage;

    }

    @Override
    public void export(DateDTO dto, HttpServletResponse response) throws ClassNotFoundException {
        List<EtlItemSummary> etlItemSummaries = baseMapper.listByPeriod(dto);

        excelTransfer.exportExcel(response, etlItemSummaries, "工作量明细", "sheet1", EtlItemSummary.class);


    }


}
